<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 从根目录下访问vue.js -->
    <script type="text/javascript" src="/js/vue.js"></script>
    <script type="text/javascript">
        Vue.config.productionTip = false  //阻止 vue 在启动时生成生产提示。
    </script>
</head>

<body>
    <div id="app">
		<button-counter></button-counter>
    </div>
</body>

</html>



<script type="text/javascript">
	Vue.component('button-counter',{
		data(){
			return {
				count: 0
			}
		},
		template: '<button v-on:click="count++">你点击了{{ count }}次</button>'
	})

	// 注：要先定义好组件，最后再new出一个vue对象，才能加载出来！
	new Vue({
	    el: "#app",
	})
</script>